package com.desay.pangoo.itmt.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.*;

import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Data;

/**
 * 技术文档（新闻）
 * 
 * @author uidq1163
 */
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "tech_news")
@Data
public class TechNewsEntity extends BaseEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", columnDefinition = "bigint COMMENT '主键'")
	private Long id;

	@Column(name = "tech_url", columnDefinition = "text COMMENT '技术新闻链接'")
	private String techUrl;

	@Column(name = "tech_context", columnDefinition = "mediumtext COMMENT '技术内容'")
	private String techContext;

	@Column(name = "tech_abstract", columnDefinition = "mediumtext COMMENT '技术摘要'")
	private String techAbstract;

	@Column(name = "tech_title", columnDefinition = "text COMMENT '技术标题'")
	private String techTitle;

	/** 技术相关域 */
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "work_group_id")
	private WorkGroupEntity workGroup;

	@Column(name = "image_info", columnDefinition = "LONGTEXT COMMENT '新闻内容图片截图信息'")
	private String imageInfo;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		TechNewsEntity other = (TechNewsEntity) obj;
		if (id == null) {
			if (other.id != null) {
				return false;
			}
		} else if (!id.equals(other.id)) {
			return false;
		}
		return true;
	}
}
